package com.ebupt.migu.music.autoTri.Enum;

import java.util.Arrays;

/**
 * @author xuhongsong
 * @version 1.0
 * @date 2021/10/21 10:11
 */
public enum CatalogInfoEnum {
    TOSONG(1,"编目接口数据"),
    TOMV(2,"mv接口数据"),
    TOWIRELESSPRODUCT(3,"曲库分发（振、全、随）产品接口");


    private Integer code;
    private String message;


    /**
     * 私有构造,防止被外部调用
     * @param code
     * @param message
     */
    CatalogInfoEnum(int code,String message){
        this.code=code;
        this.message=message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String  getValueByKey(Integer index){
        CatalogInfoEnum[] catalogInfoEnums=CatalogInfoEnum.values();
        return  Arrays.stream(catalogInfoEnums).filter(catalogInfoEnum -> catalogInfoEnum.getCode().equals(index)).findFirst().orElse(null).getMessage();
    }
}
